
from DjangoDemo.scripts.Http_Management import Http_Management
from DjangoDemo.scripts.SiteID import Sites
from DjangoDemo.scripts.Token import Token


class c3_5:
    # 默认深圳
    def __init__(self, site_name):

        self.site_name = Sites.get_mac(site_name)
        self.token = Token()
        # 定义接口的 URI
        GET_JOURNEY_URI = "/rest/campuswlanqualityservice/v1/expmonitor/common/trend"
        # 配置 URL 和 Headers
        param = '''{
          "id":"%s",
          "regionType":"site",
          "level":0,
          "tenantId":"default-organization-id",
          "startTime":1624078800000,
          "endTime":1624078800000,
          "settingRefresh":false,
          "metricType":"accessSuccessRate"
          }''' % self.site_name

        self.r = Http_Management(self.token).get(GET_JOURNEY_URI, param)

if __name__ == '__main__':
    now = c3_5("Shenzhen")
    print(now.r.json())